<template>
  <div class="swiper-box" v-if="showSwiper">
    <swiper :options="swiperOption">
      <!-- slides -->
      <swiper-slide v-for="item in swiper" :key="item.id">
        <img class="swiper-img" :src="item.imgUrl">
      </swiper-slide>
      <!-- Optional controls -->
      <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
  </div>
</template>

<script>
export default {
  name: 'HomeSwiper',
  props: {
    swiper: Array
  },
  data () {
    return {
      swiperOption: {
        loop: true,
        pagination: '.swiper-pagination'
      }
    }
  },
  computed: {
    showSwiper () {
      return this.swiper.length;
    }
  }
}
</script>

<style lang="stylus" scoped>
.swiper-box >>> .swiper-pagination-bullet-active{
  background:#fff !important;
}
.swiper-img {
  width: 100%;
  height:2.3rem;
}
</style>
